package chapter03

/**
 * @program lu-scala01
 * @description: 特质混合（匿名类） - 动态混入
 * @author: zhanglu
 * @create: 2022-03-20 22:21:00
 */
object C14_TraitMiXinAnonymous {

  def main(args: Array[String]): Unit = {
    //动态混入
    val student = new Student14 with Talent {
      override def singing: Unit = println(s"student $name is good at singing")

      override def dancing: Unit = println(s"student $name is good at dancing")
    }
    student.singing

    student.dating
    student.increase

    student.dancing

  }

}

trait Talent{
  def singing: Unit
  def dancing: Unit
}

